\(\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx\) [275]
Optimal result
Integrand size = 21, antiderivative size = 136 \[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=-\frac {\cot (c+d x) (a+b \sec (c+d x))^n}{d}+\frac {\sqrt {2} b n \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2},1-n,\frac {3}{2},\frac {1}{2} (1-\sec (c+d x)),\frac {b (1-\sec (c+d x))}{a+b}\right ) (a+b \sec (c+d x))^n \left (\frac {a+b \sec (c+d x)}{a+b}\right )^{-n} \tan (c+d x)}{(a+b) d \sqrt {1+\sec (c+d x)}}
\]
[Out]
-cot(d*x+c)*(a+b*sec(d*x+c))^n/d+b*n*AppellF1(1/2,1-n,1/2,3/2,b*(1-sec(d*x+c))/(a+b),1/2-1/2*sec(d*x+c))*(a+b*
sec(d*x+c))^n*2^(1/2)*tan(d*x+c)/(a+b)/d/(((a+b*sec(d*x+c))/(a+b))^n)/(1+sec(d*x+c))^(1/2)
Rubi [A] (verified)
Time = 0.20 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.00, number of
steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3960, 3919, 144, 143}
\[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=\frac {\sqrt {2} b n \tan (c+d x) (a+b \sec (c+d x))^n \left (\frac {a+b \sec (c+d x)}{a+b}\right )^{-n} \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2},1-n,\frac {3}{2},\frac {1}{2} (1-\sec (c+d x)),\frac {b (1-\sec (c+d x))}{a+b}\right )}{d (a+b) \sqrt {\sec (c+d x)+1}}-\frac {\cot (c+d x) (a+b \sec (c+d x))^n}{d}
\]
[In]
Int[Csc[c + d*x]^2*(a + b*Sec[c + d*x])^n,x]
[Out]
-((Cot[c + d*x]*(a + b*Sec[c + d*x])^n)/d) + (Sqrt[2]*b*n*AppellF1[1/2, 1/2, 1 - n, 3/2, (1 - Sec[c + d*x])/2,
(b*(1 - Sec[c + d*x]))/(a + b)]*(a + b*Sec[c + d*x])^n*Tan[c + d*x])/((a + b)*d*Sqrt[1 + Sec[c + d*x]]*((a +
b*Sec[c + d*x])/(a + b))^n)
Rule 143
Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_))^(p_), x_Symbol] :> Simp[((a + b*x)
^(m + 1)/(b*(m + 1)*(b/(b*c - a*d))^n*(b/(b*e - a*f))^p))*AppellF1[m + 1, -n, -p, m + 2, (-d)*((a + b*x)/(b*c
- a*d)), (-f)*((a + b*x)/(b*e - a*f))], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && !IntegerQ[m] && !Inte
gerQ[n] && !IntegerQ[p] && GtQ[b/(b*c - a*d), 0] && GtQ[b/(b*e - a*f), 0] && !(GtQ[d/(d*a - c*b), 0] && GtQ[
d/(d*e - c*f), 0] && SimplerQ[c + d*x, a + b*x]) && !(GtQ[f/(f*a - e*b), 0] && GtQ[f/(f*c - e*d), 0] && Simpl
erQ[e + f*x, a + b*x])
Rule 144
Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_))^(p_), x_Symbol] :> Dist[(e + f*x)^
FracPart[p]/((b/(b*e - a*f))^IntPart[p]*(b*((e + f*x)/(b*e - a*f)))^FracPart[p]), Int[(a + b*x)^m*(c + d*x)^n*
(b*(e/(b*e - a*f)) + b*f*(x/(b*e - a*f)))^p, x], x] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && !IntegerQ[m]
&& !IntegerQ[n] && !IntegerQ[p] && GtQ[b/(b*c - a*d), 0] && !GtQ[b/(b*e - a*f), 0]
Rule 3919
Int[csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_), x_Symbol] :> Dist[Cot[e + f*x]/(f*Sqr
t[1 + Csc[e + f*x]]*Sqrt[1 - Csc[e + f*x]]), Subst[Int[(a + b*x)^m/(Sqrt[1 + x]*Sqrt[1 - x]), x], x, Csc[e + f
*x]], x] /; FreeQ[{a, b, e, f, m}, x] && NeQ[a^2 - b^2, 0] && !IntegerQ[2*m]
Rule 3960
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)/cos[(e_.) + (f_.)*(x_)]^2, x_Symbol] :> Simp[Tan[e + f*x]*((a
+ b*Csc[e + f*x])^m/f), x] + Dist[b*m, Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^(m - 1), x], x] /; FreeQ[{a, b, e
, f, m}, x]
Rubi steps \begin{align*}
\text {integral}& = -\frac {\cot (c+d x) (a+b \sec (c+d x))^n}{d}+(b n) \int \sec (c+d x) (a+b \sec (c+d x))^{-1+n} \, dx \\ & = -\frac {\cot (c+d x) (a+b \sec (c+d x))^n}{d}-\frac {(b n \tan (c+d x)) \text {Subst}\left (\int \frac {(a+b x)^{-1+n}}{\sqrt {1-x} \sqrt {1+x}} \, dx,x,\sec (c+d x)\right )}{d \sqrt {1-\sec (c+d x)} \sqrt {1+\sec (c+d x)}} \\ & = -\frac {\cot (c+d x) (a+b \sec (c+d x))^n}{d}-\frac {\left (b n (a+b \sec (c+d x))^n \left (-\frac {a+b \sec (c+d x)}{-a-b}\right )^{-n} \tan (c+d x)\right ) \text {Subst}\left (\int \frac {\left (-\frac {a}{-a-b}-\frac {b x}{-a-b}\right )^{-1+n}}{\sqrt {1-x} \sqrt {1+x}} \, dx,x,\sec (c+d x)\right )}{(a+b) d \sqrt {1-\sec (c+d x)} \sqrt {1+\sec (c+d x)}} \\ & = -\frac {\cot (c+d x) (a+b \sec (c+d x))^n}{d}+\frac {\sqrt {2} b n \operatorname {AppellF1}\left (\frac {1}{2},\frac {1}{2},1-n,\frac {3}{2},\frac {1}{2} (1-\sec (c+d x)),\frac {b (1-\sec (c+d x))}{a+b}\right ) (a+b \sec (c+d x))^n \left (\frac {a+b \sec (c+d x)}{a+b}\right )^{-n} \tan (c+d x)}{(a+b) d \sqrt {1+\sec (c+d x)}} \\
\end{align*}
Mathematica [B] (warning: unable to verify)
Leaf count is larger than twice the leaf count of optimal. \(3614\) vs. \(2(136)=272\).
Time = 17.33 (sec) , antiderivative size = 3614, normalized size of antiderivative = 26.57
\[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=\text {Result too large to show}
\]
[In]
Integrate[Csc[c + d*x]^2*(a + b*Sec[c + d*x])^n,x]
[Out]
((b + a*Cos[c + d*x])^n*Cot[(c + d*x)/2]*Csc[c + d*x]^2*Sec[c + d*x]^n*(a + b*Sec[c + d*x])^n*(-((AppellF1[-1/
2, n, -n, 1/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*(Cos[c + d*x]*Sec[(c + d*x)/2]^2)^n)/
(((b + a*Cos[c + d*x])*Sec[(c + d*x)/2]^2)/(a + b))^n) + (3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/2]
^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Tan[(c + d*x)/2]^2)/(3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*
x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + 2*n*((-a + b)*AppellF1[3/2, n, 1 - n, 5/2, Tan[(c + d*x)/2]^2
, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a + b)*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*T
an[(c + d*x)/2]^2)/(a + b)])*Tan[(c + d*x)/2]^2)))/(2*d*(-1/4*((b + a*Cos[c + d*x])^n*Csc[(c + d*x)/2]^2*Sec[c
+ d*x]^n*(-((AppellF1[-1/2, n, -n, 1/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*(Cos[c + d*
x]*Sec[(c + d*x)/2]^2)^n)/(((b + a*Cos[c + d*x])*Sec[(c + d*x)/2]^2)/(a + b))^n) + (3*(a + b)*AppellF1[1/2, n,
-n, 3/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Tan[(c + d*x)/2]^2)/(3*(a + b)*AppellF1[1/
2, n, -n, 3/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + 2*n*((-a + b)*AppellF1[3/2, n, 1 -
n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a + b)*AppellF1[3/2, 1 + n, -n, 5/2, Tan[
(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)])*Tan[(c + d*x)/2]^2))) - (a*n*(b + a*Cos[c + d*x])^(-1 +
n)*Cot[(c + d*x)/2]*Sec[c + d*x]^n*Sin[c + d*x]*(-((AppellF1[-1/2, n, -n, 1/2, Tan[(c + d*x)/2]^2, ((a - b)*T
an[(c + d*x)/2]^2)/(a + b)]*(Cos[c + d*x]*Sec[(c + d*x)/2]^2)^n)/(((b + a*Cos[c + d*x])*Sec[(c + d*x)/2]^2)/(a
+ b))^n) + (3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Tan
[(c + d*x)/2]^2)/(3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)
] + 2*n*((-a + b)*AppellF1[3/2, n, 1 - n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a
+ b)*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)])*Tan[(c + d*x)/2]
^2)))/2 + (n*(b + a*Cos[c + d*x])^n*Cot[(c + d*x)/2]*Sec[c + d*x]^(1 + n)*Sin[c + d*x]*(-((AppellF1[-1/2, n, -
n, 1/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*(Cos[c + d*x]*Sec[(c + d*x)/2]^2)^n)/(((b +
a*Cos[c + d*x])*Sec[(c + d*x)/2]^2)/(a + b))^n) + (3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/2]^2, ((a
- b)*Tan[(c + d*x)/2]^2)/(a + b)]*Tan[(c + d*x)/2]^2)/(3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/2]^2
, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + 2*n*((-a + b)*AppellF1[3/2, n, 1 - n, 5/2, Tan[(c + d*x)/2]^2, ((a -
b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a + b)*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c +
d*x)/2]^2)/(a + b)])*Tan[(c + d*x)/2]^2)))/2 + ((b + a*Cos[c + d*x])^n*Cot[(c + d*x)/2]*Sec[c + d*x]^n*(-(((C
os[c + d*x]*Sec[(c + d*x)/2]^2)^n*(((a - b)*n*AppellF1[1/2, n, 1 - n, 3/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c
+ d*x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2])/(a + b) - n*AppellF1[1/2, 1 + n, -n, 3/2, Tan[(c +
d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2]))/(((b + a*Cos[c + d*x])
*Sec[(c + d*x)/2]^2)/(a + b))^n) - (n*AppellF1[-1/2, n, -n, 1/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]
^2)/(a + b)]*(Cos[c + d*x]*Sec[(c + d*x)/2]^2)^(-1 + n)*(-(Sec[(c + d*x)/2]^2*Sin[c + d*x]) + Cos[c + d*x]*Sec
[(c + d*x)/2]^2*Tan[(c + d*x)/2]))/(((b + a*Cos[c + d*x])*Sec[(c + d*x)/2]^2)/(a + b))^n + n*AppellF1[-1/2, n,
-n, 1/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*(Cos[c + d*x]*Sec[(c + d*x)/2]^2)^n*(((b +
a*Cos[c + d*x])*Sec[(c + d*x)/2]^2)/(a + b))^(-1 - n)*(-((a*Sec[(c + d*x)/2]^2*Sin[c + d*x])/(a + b)) + ((b +
a*Cos[c + d*x])*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2])/(a + b)) + (3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c +
d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2])/(3*(a + b)*AppellF1[1/2
, n, -n, 3/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + 2*n*((-a + b)*AppellF1[3/2, n, 1 - n
, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a + b)*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(
c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)])*Tan[(c + d*x)/2]^2) + (3*(a + b)*Tan[(c + d*x)/2]^2*(-1/
3*((a - b)*n*AppellF1[3/2, n, 1 - n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c + d
*x)/2]^2*Tan[(c + d*x)/2])/(a + b) + (n*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*
x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2])/3))/(3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/
2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + 2*n*((-a + b)*AppellF1[3/2, n, 1 - n, 5/2, Tan[(c + d*x)/2]^2, (
(a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a + b)*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[
(c + d*x)/2]^2)/(a + b)])*Tan[(c + d*x)/2]^2) - (3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/2]^2, ((a -
b)*Tan[(c + d*x)/2]^2)/(a + b)]*Tan[(c + d*x)/2]^2*(2*n*((-a + b)*AppellF1[3/2, n, 1 - n, 5/2, Tan[(c + d*x)/
2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a + b)*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a -
b)*Tan[(c + d*x)/2]^2)/(a + b)])*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2] + 3*(a + b)*(-1/3*((a - b)*n*AppellF1[3/2
, n, 1 - n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2]
)/(a + b) + (n*AppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c
+ d*x)/2]^2*Tan[(c + d*x)/2])/3) + 2*n*Tan[(c + d*x)/2]^2*((-a + b)*((3*(a - b)*(1 - n)*AppellF1[5/2, n, 2 - n
, 7/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2])/(5*(a +
b)) + (3*n*AppellF1[5/2, 1 + n, 1 - n, 7/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c +
d*x)/2]^2*Tan[(c + d*x)/2])/5) + (a + b)*((-3*(a - b)*n*AppellF1[5/2, 1 + n, 1 - n, 7/2, Tan[(c + d*x)/2]^2,
((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)/2])/(5*(a + b)) + (3*(1 + n)*AppellF1[5
/2, 2 + n, -n, 7/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)]*Sec[(c + d*x)/2]^2*Tan[(c + d*x)
/2])/5))))/(3*(a + b)*AppellF1[1/2, n, -n, 3/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + 2*
n*((-a + b)*AppellF1[3/2, n, 1 - n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)] + (a + b)*A
ppellF1[3/2, 1 + n, -n, 5/2, Tan[(c + d*x)/2]^2, ((a - b)*Tan[(c + d*x)/2]^2)/(a + b)])*Tan[(c + d*x)/2]^2)^2)
)/2))
Maple [F]
\[\int \csc \left (d x +c \right )^{2} \left (a +b \sec \left (d x +c \right )\right )^{n}d x\]
[In]
int(csc(d*x+c)^2*(a+b*sec(d*x+c))^n,x)
[Out]
int(csc(d*x+c)^2*(a+b*sec(d*x+c))^n,x)
Fricas [F]
\[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=\int { {\left (b \sec \left (d x + c\right ) + a\right )}^{n} \csc \left (d x + c\right )^{2} \,d x }
\]
[In]
integrate(csc(d*x+c)^2*(a+b*sec(d*x+c))^n,x, algorithm="fricas")
[Out]
integral((b*sec(d*x + c) + a)^n*csc(d*x + c)^2, x)
Sympy [F]
\[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right )^{n} \csc ^{2}{\left (c + d x \right )}\, dx
\]
[In]
integrate(csc(d*x+c)**2*(a+b*sec(d*x+c))**n,x)
[Out]
Integral((a + b*sec(c + d*x))**n*csc(c + d*x)**2, x)
Maxima [F]
\[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=\int { {\left (b \sec \left (d x + c\right ) + a\right )}^{n} \csc \left (d x + c\right )^{2} \,d x }
\]
[In]
integrate(csc(d*x+c)^2*(a+b*sec(d*x+c))^n,x, algorithm="maxima")
[Out]
integrate((b*sec(d*x + c) + a)^n*csc(d*x + c)^2, x)
Giac [F]
\[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=\int { {\left (b \sec \left (d x + c\right ) + a\right )}^{n} \csc \left (d x + c\right )^{2} \,d x }
\]
[In]
integrate(csc(d*x+c)^2*(a+b*sec(d*x+c))^n,x, algorithm="giac")
[Out]
integrate((b*sec(d*x + c) + a)^n*csc(d*x + c)^2, x)
Mupad [F(-1)]
Timed out. \[
\int \csc ^2(c+d x) (a+b \sec (c+d x))^n \, dx=\int \frac {{\left (a+\frac {b}{\cos \left (c+d\,x\right )}\right )}^n}{{\sin \left (c+d\,x\right )}^2} \,d x
\]
[In]
int((a + b/cos(c + d*x))^n/sin(c + d*x)^2,x)
[Out]
int((a + b/cos(c + d*x))^n/sin(c + d*x)^2, x)